package com.ftg.examsys.util;

import java.util.List;

/**
 * 分页封装
 *
 * @author kangjx
 * @version 1.0
 * @date 2023/9/13 下午2:07
 */
public class PageEx<E> {

    public PageEx(long pageNo, long limit) {
        this.pageNo = pageNo;
        this.limit = limit;
    }

    private long pageNo;

    private long limit;

    private long total;

    private long pages;

    private List<E> rows;


    public long getPageNo() {
        return pageNo;
    }

    public void setPageNo(long pageNo) {
        this.pageNo = pageNo;
    }

    public long getLimit() {
        return limit;
    }

    public void setLimit(long limit) {
        this.limit = limit;
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public long getPages() {
        int n = this.getTotal() % this.getLimit() == 0 ? 0 : 1;
        return this.getTotal() / this.getLimit() + n;
    }

    public void setPages(long pages) {
        this.pages = pages;
    }

    public List<E> getRows() {
        return rows;
    }

    public void setRows(List<E> rows) {
        this.rows = rows;
    }
}
